﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RegisterationCommon.Common;
using System.Data;

namespace RegisterationCommon.NoticeReceive
{
    public class NoticeReceive
    {
        #region Model
        private int _id;
        private string _sname;
        private string _gname;
        private int _schid;
        private int _noticeid ;
        private DateTime _receivetime;
        private int _studentid;
        private string _address;
        private string _ext1;
        private string _ext2;
        private string _ext3;
        private string _ext4;
        /// <summary>
        /// 
        /// </summary>
        public int ID
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Sname
        {
            set { _sname = value; }
            get { return _sname; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Gname
        {
            set { _gname = value; }
            get { return _gname; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int SchId
        {
            set { _schid = value; }
            get { return _schid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int NoticeID
        {
            set { _noticeid = value; }
            get { return _noticeid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime ReceiveTime
        {
            set { _receivetime = value; }
            get { return _receivetime; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int StudentID
        {
            set { _studentid = value; }
            get { return _studentid; }
        }
        public string Address
        {
            set { _address = value; }
            get { return _address; }
        }
        public string Ext1
        {
            set { _ext1 = value; }
            get { return _ext1; }
        }
        public string Ext2
        {
            set { _ext2 = value; }
            get { return _ext2; }
        }
        public string Ext3
        {
            set { _ext3 = value; }
            get { return _ext3; }
        }
        public string Ext4
        {
            set { _ext4 = value; }
            get { return _ext4; }
        }
        #endregion Model
        #region 方法列表
        public bool AddNoticePt()
        {
            RParams RP = new RParams();
            RP.Add("Sname", this._sname, SqlDbType.NVarChar);
            RP.Add("Gname", this._gname, SqlDbType.NVarChar);
            RP.Add("SchId", this._schid, SqlDbType.Int);
            RP.Add("NoticeID", this._noticeid, SqlDbType.Int);
            RP.Add("StudentID", this._studentid, SqlDbType.Int);
            RP.Add("ReceiveTime", this._receivetime, SqlDbType.DateTime);
            RP.Add("Address", this._address, SqlDbType.NVarChar);
            RP.Add("Ext1", this._ext1, SqlDbType.NVarChar);
            RP.Add("Ext2", this._ext2, SqlDbType.NVarChar);
            RP.Add("Ext3", this._ext3, SqlDbType.NVarChar);
            RP.Add("Ext4", this._ext4, SqlDbType.NVarChar);

            return AddNotice(RP);
        }
        public bool AddNotice(RParams RP)
        {
            return DBAction.Insert(ETableName.NoticeReceive, RP);
        }
        #endregion

        #region 根据ID查询公告信息
        /// <summary>
        /// 根据ID查询公告信息
        /// </summary>
        /// <param name="leaveID">公告信息编号</param>
        /// <returns>查询成功返回true,否则返回false</returns>
        //public bool GetHelpSubjectByID(int noticeID)
        //{
        //    DataTable dt = DBAction.GetDTFromSQL("Select * From " + ETableName.NoticeReceive + " where id=" + noticeID);
        //    if (dt.Rows.Count < 1)
        //    {
        //        return false;
        //    }
        //    this._id = noticeID;
        //    this._title = Convert.ToString(dt.Rows[0]["Title"]);
        //    this._content = Convert.ToString(dt.Rows[0]["Content"]);
        //    this._recrive = Convert.ToInt32(dt.Rows[0]["Recrive"]);
        //    this._status = Convert.ToInt32(dt.Rows[0]["Status"]);
        //    this._rtime = Convert.ToDateTime(dt.Rows[0]["RTime"]);
        //    return true;
        //}
        #endregion
    }
}
